#ifndef PAGE_BASE_H
#define PAGE_BASE_H
#define ENABLE_GxEPD2_GFX 1

#include <Arduino.h>
#include <GxEPD2_3C.h>
#include <U8g2_for_Adafruit_GFX.h>
#include <map>
#include "../helper/helper.h"

// #define SCREEN_HEIGHT_STEP 120
// #define SCREEN_HEIGHT_STEP 160
// #define SCREEN_HEIGHT_STEP 240
#define SCREEN_HEIGHT_STEP 240

#define PIN_SPI_SCK 18
#define PIN_SPI_DIN 23
#define PIN_SPI_CS 5
#define PIN_SPI_BUSY 17
#define PIN_SPI_RST 16
#define PIN_SPI_DC 19

namespace Page
{

    class Base
    {

    protected:
        static GxEPD2_3C<GxEPD2_750c_Z08, SCREEN_HEIGHT_STEP> display;
        U8G2_FOR_ADAFRUIT_GFX u8g2Fonts;
        const uint8_t *_getFont(int fontSize);
        void _displayTextCenter(String text, int size, int centerX, int centerY);
        void _displayTempCenter(float temp, int size, int centerX, int centerY);
        void _displayIconCenter(String iconName, int size, int centerX, int centerY);
        void _displayFloatCenter(float num, String format, int fontSize, int centerX, int centerY);

        void _displayTextLeft(String text, int size, int leftX, int centerY);
        void _displayTempLeft(float temp, int size, int leftX, int centerY);
        void _displayIntLeft(int num, String format, int fontSize, int leftX, int centerY);

        void _displayBatteryCenter(float battery, int centerX, int centerY);

    public:
        Base();
    };

}

#endif